<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<title>线下预约</title>
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">		
	<link rel="stylesheet" href="css/mui.min.css">
	<link rel="stylesheet" href="css/grandeHealth.css">
	<link rel="stylesheet" type="text/css" href="css/myList.css"/>
	<style>
		.mui-table-view .mui-table-view-cell .department {width: 55%;}
		.mui-table-view .mui-table-view-cell .stars {float: right;}
		.mui-table-view .mui-table-view-cell .kaoheDate {line-height: 30px;}
	</style>
	</head>
	<body>
		<!--下拉刷新容器-->
	    <div class="mui-scroll-wrapper" id="pullrefresh">
	      <div class="mui-scroll">
	        <!-- 数据列表 -->
	        <ul class="mui-table-view">
				<!--<li class="mui-table-view-cell">
					<a href="javascript:;"> 
						<img class="mui-pull-left" src="images/kaoheHead.png"> 
						<div class="mui-media-body"> 
							<span class="kaoheDate">2017-07-31</span> 
							<p class="name">王冰</p> 
							<p class="department">男&nbsp;&nbsp;27岁</p>
							<p class="stars">13:00-16:00</p>
						</div> 
					</a>
				</li>-->
	       </ul>
	      </div>
	    </div>
	    <!--暂无记录-->
	    <div class="mui-content" style="display:none">
	      <div class="nomessage">
	        <img src="images/zanwujilu.png"/>
	        <p>暂无记录</p>
	      </div>
	    </div>	    
		<script sr`c="js/jquery-1.7.2.min.js"></script>
		<script src="js/mui.min.js"></script>
		<script src="js/grandeHealth.js"></script>
		<script src="js/medicalRecord.js"></script>
		<script>		
			mui.init({
		        pullRefresh: {
		          container: '#pullrefresh',
		          down: {
		            callback: pulldownRefresh
		          },
		          up: {
		            contentrefresh: '正在加载...',
		            callback: pullupRefresh
		          }
		        }
	      	});
						
//			var XHDOC_APP_USRID = '15288888888';
			var arry = {};
			var count = 1;
			var totalNumber;//总条数
			var webUrl = XHDOC_WEBBASE+"Docpre/Off?&pageSize=10&id="+XHDOC_APP_USRID;
			var imgurl = 'http://106.14.139.5:7014/GZ/images/getimages?guid=';
			function jiaohu() { 
				try {
				  $.ajax({
				    url: webUrl,
				    type: "GET",
					async: false,
					dataType: "json",
					data: {
					  pageNo: count
					},
					success: function(data) {
						totalNumber = Math.ceil(data.data.pageSize/10);//总条数
												
					  	try {
					  		
					  		if(XHDOC_BROWSETYPE == 'IOS') {					
																
							} else if(XHDOC_BROWSETYPE == 'ANDROID') {
			
								window.parent.android.my_xxyuyue(data.data.pageSize);			
							}
					  	
						    if(data.code == 000){
						    	
						    	arry = data.data;
						    }				    
					  	} catch(e) {
					    
					    	mui.toast('获取数据失败');
					  	}
					},
					error: function(xhr, textStatus, error) {						
						if(textStatus == "error")
						mui.toast('请检查网络连接');
					}
					
				  });
				
				} catch(e) {
				
				  mui.toast("请检查网络连接");
				
			    }
			
			};
				
			/**
			   * 下拉刷新具体业务实现
			*/
		  	function pulldownRefresh() {
		  	
		    	jiaohu();
		    	
			    setTimeout(function() {	          
			      var table = document.body.querySelector('.mui-table-view');
			      var cells = document.body.querySelectorAll('.mui-table-view-cell');
			      for(var i = 0; i < arry.length; i++) {
			        var li = document.createElement('li');
			        li.className = 'mui-table-view-cell mui-media';
			        var dateTime = arry.parameterType[i].crtdat;
					var mydate=dateTime.substr(0,10); 
					var mytime=dateTime.substr(11,11);
					var sex = arry.parameterType[i].sex;
					if(sex == 1){sex = "男"}else if(sex == 2){sex = "女"}else{sex = ""}
					li.innerHTML = 
								'<a href="javascript:;">'+
									'<img class="mui-pull-left" src="'+imgurl+arry.parameterType[i].guid+'">'+
									'<div class="mui-media-body">'+
										'<span class="kaoheDate">'+mydate+'</span>'+
										'<p class="name">'+arry.parameterType[i].name+'</p>'+
										'<p class="department">'+sex+'&nbsp;&nbsp;'+arry.parameterType[i].age+'</p>'+
										'<p class="stars">'+mytime+'</p>'+
									'</div>'+
								'</a>';
			      }
			      mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
			
			    }, 1500);
		    
		  	}
	
			/**
			   * 上拉加载具体业务实现
			*/
		  	function pullupRefresh() {
		
		        jiaohu();
				
		        setTimeout(function() { 
		          mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count >= totalNumber+1)); //参数为true代表没有更多数据了。
		          var table = document.body.querySelector('.mui-table-view');
		          var cells = document.body.querySelectorAll('.mui-table-view-cell');
		          if(arry.parameterType == ""){
			    		setTimeout("$('.mui-content').show();",1300);
			    	}
		          for(var i = 0, len = i + 10; i < len; i++) {
		            var li = document.createElement('li');
		            li.className = 'mui-table-view-cell mui-media';					
					
					var dateTime = arry.parameterType[i].crtdat;
					var mydate=dateTime.substr(0,10); 
					var mytime=dateTime.substr(11,11);
					var sex = arry.parameterType[i].sex;
					if(sex == 1){sex = "男"}else if(sex == 2){sex = "女"}else{sex = ""}
					li.innerHTML = 
								'<a href="javascript:;">'+
									'<img class="mui-pull-left" src="'+imgurl+arry.parameterType[i].guid+'">'+
									'<div class="mui-media-body">'+
										'<span class="kaoheDate">'+mydate+'</span>'+
										'<p class="name">'+arry.parameterType[i].name+'</p>'+
										'<p class="department">'+sex+'&nbsp;&nbsp;'+arry.parameterType[i].age+'</p>'+
										'<p class="stars">'+mytime+'</p>'+
									'</div>'+
								'</a>';
												
		            table.appendChild(li);
		          }
		
		        }, 1500);
		  	}
	
		  	if(mui.os.plus) {
		        mui.plusReady(function() {
		          	setTimeout(function() {
		            	mui('#pullrefresh').pullRefresh().pullupLoading();
		      		}, 1000);
		
		        });
		  	} else {
		        mui.ready(function() {
		          mui('#pullrefresh').pullRefresh().pullupLoading();
		        });
		  	}
		      	      						
			//返回箭头事件
//			mui.back = function() {		
//				try {
//					
//					if(XHDOC_BROWSETYPE == 'IOS') {
//					
//						//调用IOS的返回事件
//						
//					} else if(XHDOC_BROWSETYPE == 'ANDROID') {
//	
//						//调用ANDROID的返回事件
//	
//					}		
//		
//				} catch(e) {
//					console.log(e);
//				}		
//			}	
    </script>   
	</body>
</html>


